import CZML_GENERALTOOLS_CLASS from "./CZML_GENERALTOOLS_CLASS.js"
import SMAP_LinkedList from "../utils/SMAP_LinkedList.js"

/**
 * 月球视角下的功能集
 *
 * @class CZML_MOONVIEWER_CLASS
 */
class CZML_MOONVIEWER_CLASS {
  static HEU_CzmlListmoon = new SMAP_LinkedList() // 新建存储CZML对象链表
  static HEU_DataSourcemoon = new Cesium.CzmlDataSource() // 新建cesium的CZML数据源
  cartesianstart

  /**
   * 创建CZML_MOONVIEWER_CLASS实体对象，注册地球视角earthViewer，并初始化月球视角moonViewer
   * @param {*} earthViewer 地球视角viewer
   * @memberof CZML_MOONVIEWER_CLASS
   */
  constructor(earthViewer) {
    this._earthViewer = earthViewer
    this._moonViewer = new Cesium.Viewer("moon", {
      mapProjection: new Cesium.WebMercatorProjection(new Cesium.Ellipsoid(0.1, 0.1, 0.1)), // new Cesium.WebMercatorProjection(new Cesium.Ellipsoid(1037400,1037400,1037400)),new Cesium.GeographicProjection(Cesium.Ellipsoid.MOON)
      globe: new Cesium.Globe(new Cesium.GeographicProjection(Cesium.Ellipsoid.MOON).ellipsoid),
      terrainExaggeration: 0.25,
      skyAtmosphere: false,
      imageryProvider: new Cesium.SingleTileImageryProvider({
        url: "../SampleData/moon.jpg",
        tilingScheme: new Cesium.WebMercatorTilingScheme({
          ellipsoid: Cesium.Ellipsoid.MOON,
          numberOfLevelZeroTilesX: 1,
          numberOfLevelZeroTilesY: 1
        }),
        layers: "nurc:Arc_Sample"
      }),
      baseLayerPicker: false
    })
  }

  /**
   *
   * 向HEU_CzmlListmoon中插入一个对象（内部使用）
   * @param {*} id <String>cesium中对象id
   * @param {*} data <Object>要插入的数据
   * @param {*} bCheck <Boolean> 是否检测HEU_CzmlListmoon已存在该id对象
   * @returns <Boolean> 新添加id时返回true，替换存在id时返回false
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_CzmlListInsertmoon(id, data, bCheck) {
    // 不检测
    if (bCheck === false) {
      CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.push(data)
      return true
    }
    // 进行检测
    // 查找对应id
    const FindNode = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.find(function (node) {
      return node.data().id === id
    })
    // 如果存在直接替换
    if (FindNode !== null) {
      FindNode.data(data)
      return false
    } else {
      CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.push(data)
      return true
    }
  }

  /**
   *
   * cesium上图，在HEU_SaveCzml和HEU_Czml之间转移内容(内部使用)
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_CesiumLoadCzmlmoon() {
    // 将HEU_CzmlList中的document对应的时间设置当前时间
    const FindNode = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.find(function (node) {
      return node.data().id === "document"
    })
    if (FindNode !== null) {
      // 判断当前场景时间是否在重新加载后的场景时间内
      const CurTime = Cesium.JulianDate.toIso8601(this._moonViewer.clock._currentTime)
      const ScenarioStartTime = CZML_GENERALTOOLS_CLASS.ISO8601ToUtcgTimeTransformation(FindNode.data().clock.interval.split("/")[0])
      const ScenarioEndTime = CZML_GENERALTOOLS_CLASS.ISO8601ToUtcgTimeTransformation(FindNode.data().clock.interval.split("/")[1])
      const diffSec1 = CZML_GENERALTOOLS_CLASS.SMAP_CalDiffSecsOfUTCGs(
        ScenarioStartTime,
        CZML_GENERALTOOLS_CLASS.ISO8601ToUtcgTimeTransformation(CurTime)
      )
      const diffSec2 = CZML_GENERALTOOLS_CLASS.SMAP_CalDiffSecsOfUTCGs(
        ScenarioEndTime,
        CZML_GENERALTOOLS_CLASS.ISO8601ToUtcgTimeTransformation(CurTime)
      )
      if (diffSec1 <= 0 && diffSec2 >= 0) {
        FindNode.data().clock.currentTime = CurTime
      }
    }
    // 删除之前的数据
    this._moonViewer.dataSources.remove(this._moonViewer.dataSources.get(0))
    // 添加新数据
    const HEU_LoadCzml = new Array(CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.size())
    for (let i = 0; i < HEU_LoadCzml.length; i++) {
      HEU_LoadCzml[i] = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.get(i).data()
    }
    // 上图
    const dataCzml = CZML_MOONVIEWER_CLASS.HEU_DataSourcemoon.load(HEU_LoadCzml)
    this._moonViewer.dataSources.add(dataCzml)
    CZML_MOONVIEWER_CLASS.HEU_DataSourcemoon.show = true
  }

  /**
   *
   * 判断地图上有没有某个物体
   * @param {*} id <String> cesium场景中渲染对象ID，UUID字符串
   * @returns <boolean> 是否存在
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_CesiumCheckIDIsExitofMoon(id) {
    // 查找对应id
    const FindNode = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.find(function (node) {
      return node.data().id === id
    })
    if (FindNode !== null) {
      return true
    } else {
      return false
    }
  }

  /**
   *
   * 根据指定的适配字符串删除所有的与其相关的场景对象
   * @param {*} maskstr <String> 适配字符串
   * @returns <Boolean> 是否循环删除所有满足条件的节点
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_DeleteCesiumObjectsByMaskStrofMoon(maskstr) {
    const MapNodes = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.map(function (node) {
      return node.data().id.includes(maskstr)
    })

    if (MapNodes.length <= 0) {
      return false
    }

    // 循环删除所有满足条件的节点
    for (let i = 0; i < MapNodes.length; i++) {
      CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.remove(MapNodes[i])
    }
    return true
  }

  /**
   *
   * 切换至月球为中心天体
   * @memberof CZML_MOONVIEWER_CLASS
   */
  moon() {
    // 页面设置
    document.getElementById("moon").style.cssText = "width:100%;height:100%;margin:0;padding:0;overflow:hidden;position:absolute;top:0px"
    document.getElementById("map3d").style.cssText = "width:0%"
    // document.getElementById("cesiumContainer").style.cssText = "width:0%";
    // 时间轴设置
    const curTime = this._moonViewer.timeline._clock.currentTime
    this._moonViewer.timeline._clock._currentTime = curTime
    // 其他设置
    this._moonViewer.scene.moon.show = false
    this._moonViewer.scene.moon.textureUrl = "../SampleData/moonviewer2.jpg"
    this._moonViewer.scene.sun.show = false
  }

  /**
   *
   * 切换至地球为中心天体
   * @memberof CZML_MOONVIEWER_CLASS
   */
  earth() {
    document.getElementById("moon").style.cssText = "width:0%"
    document.getElementById("map3d").style.cssText = "width:100%"
    // document.getElementById("cesiumContainer").style.cssText = "width:100%";
    const curTime = this._moonViewer.timeline._clock.currentTime
    this._earthViewer.timeline._clock._currentTime = curTime
  }

  /**
   *
   * 新建月球场景
   * @param {*} strStartTime <String> 场景开始时间，输入为UTCG格式
   * @param {*} strEndTime <String> 场景结束时间，输入为UTCG格式
   * @param {*} strScenarioName <String> 场景名称
   * @param {*} Model3DPath <String> 月球gltf模型路径
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_NewScenarioofMoon(strStartTime, strEndTime, strScenarioName, Model3DPath) {
    // UTCG时间转换，保存场景时间
    const StartTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(strStartTime)
    const EndTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(strEndTime)
    const HEU_ScenarioTime = StartTime + "/" + EndTime
    const ScenarioData = {
      id: "document",
      name: strScenarioName,
      version: "1.0",
      clock: {
        interval: HEU_ScenarioTime,
        currentTime: StartTime,
        multiplier: 0,
        range: "LOOP_STOP",
        step: "SYSTEM_CLOCK_MULTIPLIER"
      }
    }
    const ret = this.HEU_CzmlListInsertmoon("document", ScenarioData, true)
    this.HEU_CesiumLoadCzmlmoon(this._moonViewer)
    this.HEU_AddmooninMV(strStartTime, strEndTime, 1738000, Model3DPath, this._moonViewer)
    return ret
  }

  /**
   *
   * 添加行星
   * @param {*} id 唯一id
   * @param {*} name 行星名称，字符串
   * @param {*} OrbitStartTime 建立场景时间，字符串
   * @param {*} OrbitEndTime 场景结束时间，字符串
   * @param {*} position 行星轨道数据 J2000 数组：[t(s),x(m),y(m),z(m),t(s),x(m),y(m),z(m)]
   * @param {*} scale 模型大小，数字
   * @param {*} Model3DPath 模型路径
   * @param {*} referenceFrame 行星参考系设定，字符串，两种可选（"FIXED" ，"INERTIAL"）
   * @param {*} viewer 中心天体对应的viewer
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddStarinMoonViewer(id, name, OrbitStartTime, OrbitEndTime, position, scale, Model3DPath, referenceFrame, viewer) {
    // viewer.scene.moon.show=false;//删除cesium中月球
    const sOrbitStartTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitStartTime)
    const sOrbitEndTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitEndTime)
    const HEU_ScenarioTime = sOrbitStartTime + "/" + sOrbitEndTime
    const StarData = {
      id: id,
      availability: HEU_ScenarioTime,
      name: name,
      description: name,
      label: {
        fillColor: {
          rgba: [0, 255, 0, 255]
        },
        font: "11pt Lucida Console",
        horizontalOrigin: "LEFT",
        pixelOffset: {
          cartesian2: [10, 0]
        },
        show: true,
        style: "FILL_AND_OUTLINE",
        text: name,
        verticalOrigin: "CENTER"
      },
      // 更改模型路径
      model: {
        gltf: Model3DPath,
        scale: scale,
        minimumPixelSize: 1
      },
      position: {
        interpolationAlgorithm: "LAGRANGE",
        interpolationDegree: 5,
        referenceFrame: referenceFrame,
        epoch: sOrbitStartTime,
        cartesian: position
      }
    }
    // 插入该数据对象
    this.HEU_CzmlListInsertmoon(id, StarData, true)
    // 上图
    this.HEU_CesiumLoadCzmlmoon(viewer)
  }

  /**
   *
   * 添加月球场景内运动物体
   * @param {*} id ID，服务化平台给出的UUID，字符串
   * @param {*} name 名称，字符串
   * @param {*} OrbitStartTime 轨道开始时间，字符串，输入格式为UTCG
   * @param {*} OrbitEndTime 轨道结束时间，字符串，输入格式为UTCG
   * @param {*} position 位置，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]([0,30,30,30,5,30,30,30])，XYZ为地心地固坐标系下
   * @param {*} orientation 姿态，数组：[相对秒1,q1,q2,q3,q0]([0,0,0,0,1])，q0为标量
   * @param {*} ModelVisible 三维模型是否可见（true/false）
   * @param {*} Model3DPath 三维模型路径，字符串
   * @param {*} ModelSize 三维模型大小，数值（1000）
   * @param {*} MarkerVisible 二维标签是否可见（true/false）
   * @param {*} MarkerPath 二维标签图片路径，字符串
   * @param {*} MaekerPixelSize 二维标签图片大小（1）
   * @param {*} MarkerColor 二维标签颜色，数组：[R,G,B,255]（[255,0,0,255]）
   * @param {*} MarkerXOriginPos 二维标签水平对齐，字符串，三种可选（"CENTER"，"LEFT"，"RIGHT"）
   * @param {*} MarkerYOriginPos 二维标签垂直对齐，字符串，三种可选（"CENTER"，"LEFT"，"RIGHT"）
   * @param {*} OrbitLineStyle 轨迹风格，0代表直线，1代表虚线
   * @param {*} OrbitLineWidth 轨迹宽度，数值（4）
   * @param {*} OrbitColor 轨迹颜色，数组：[R,G,B,255]（[255,0,0,255]）
   * @param {*} OrbitVisible 轨迹是否可见（true/false）
   * @param {*} Distance 二三维图标切换的距离，数值(5.5e6)
   * @param {*} ReferenceFrame 轨迹姿态的参考系设定，字符串，两种可选（"FIXED" ，"INERTIAL"）默认为"FIXED"
   * @param {*} viewer 中心天体对应的viewer
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddOrbitObjectmoon(
    id,
    name,
    OrbitStartTime,
    OrbitEndTime,
    position,
    orientation,
    ModelVisible,
    Model3DPath,
    ModelSize,
    MarkerVisible,
    MarkerPath,
    MaekerPixelSize,
    MarkerColor,
    MarkerXOriginPos,
    MarkerYOriginPos,
    OrbitLineStyle,
    OrbitLineWidth,
    OrbitColor,
    OrbitVisible,
    Distance,
    ReferenceFrame,
    viewer
  ) {
    // 将UTCG的轨道开始时间转换成cesium能解析的时间格式
    const sOrbitStartTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitStartTime)
    const sOrbitEndTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitEndTime)
    const AvailabilityTime = sOrbitStartTime + "/" + sOrbitEndTime
    const HEU_ScenarioTime = sOrbitStartTime + "/" + sOrbitEndTime
    const OrbitObject = {
      id: id,
      availability: AvailabilityTime,
      name: name,
      billboard: {
        eyeOffset: {
          cartesian: [0, 0, 0]
        },
        horizontalOrigin: MarkerXOriginPos,
        distanceDisplayCondition: {
          distanceDisplayCondition: [Distance]
        },
        image: MarkerPath,
        pixelOffset: {
          cartesian2: [0, 0]
        },
        scale: MaekerPixelSize,
        show: MarkerVisible,
        verticalOrigin: MarkerYOriginPos
      },
      label: {
        fillColor: {
          rgba: MarkerColor
        },
        font: "11pt Lucida Console",
        horizontalOrigin: "LEFT",
        pixelOffset: {
          cartesian2: [10, 0]
        },
        show: MarkerVisible,
        style: "FILL_AND_OUTLINE",
        text: name,
        verticalOrigin: "CENTER"
      },
      path: {
        show: [
          {
            interval: HEU_ScenarioTime,
            boolean: OrbitVisible
          }
        ],
        width: OrbitLineWidth,
        material: CZML_GENERALTOOLS_CLASS.GetMaterialObject(OrbitLineStyle, OrbitColor),
        resolution: 120
      },
      model: {
        gltf: Model3DPath,
        scale: ModelSize,
        distanceDisplayCondition: {
          distanceDisplayCondition: [0, Distance]
        },
        show: ModelVisible,
        runAnimations: false
      },
      position: {
        interpolationAlgorithm: "LAGRANGE",
        interpolationDegree: 5,
        referenceFrame: ReferenceFrame,
        epoch: sOrbitStartTime,
        cartesian: position
      },
      orientation: {
        interpolationAlgorithm: "LAGRANGE",
        interpolationDegree: 1,
        epoch: sOrbitStartTime,
        unitQuaternion: orientation
      }
    }
    // 插入该数据对象
    const ret = this.HEU_CzmlListInsertmoon(id, OrbitObject, true)
    // 上图
    this.HEU_CesiumLoadCzmlmoon(viewer)
    return ret
  }

  /**
   *
   * 添加地球
   * @param {*} name 名称，字符串
   * @param {*} OrbitStartTime 场景开始时间，字符串，输入格式为UTCG
   * @param {*} OrbitEndTime 场景结束时间，字符串，输入格式为UTCG
   * @param {*} Model3DPath 地球gltf路径
   * @param {*} scale 模型大小，数值（63170000）
   * @param {*} Moonj2000data 月球j2000位置坐标，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddearthinMoonViewer(name, OrbitStartTime, OrbitEndTime, Model3DPath, scale, Moonj2000data) {
    const data = CZML_MOONVIEWER_CLASS.earthposition(Moonj2000data)
    return this.HEU_AddStarinMoonViewer("diqiu", name, OrbitStartTime, OrbitEndTime, data, scale, Model3DPath, "INERTIAL", this._moonViewer)
  }

  /**
   *
   * 添加地面站
   * @param {*} id <String> 全局唯一ID，服务化平台给出的UUID
   * @param {*} idRef <String> 位置参考ID
   * @param {*} name <String> 地面站名称
   * @param {*} position <Array> 地面站位置，[经度,纬度,高度]([30,30,0])
   * @param {*} ModelVisible <Boolean>三维模型是否可见
   * @param {*} Model3DPath <String> 三维模型路径
   * @param {*} ModelSize <Number> 三维模型大小,1
   * @param {*} MarkerVisible <Boolean> 二维标签是否可见
   * @param {*} MarkerPath <String> 二维标签图片路径
   * @param {*} MaekerPixelSize <Number> 二维标签图片大小,1
   * @param {*} Distance <Number> 二三维图标切换的距离，5.5e6
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddfacilityinMoonViewer(id, idRef, name, position, ModelVisible, Model3DPath, ModelSize, MarkerVisible, MarkerPath, MaekerPixelSize, Distance) {
    const Offset = Cesium.Cartesian3.fromArray(CZML_GENERALTOOLS_CLASS.GetMaterialObject(position)) // FIXED
    const getPosition = function () {
      const originpoint = Cesium.Cartesian3.fromArray(
        this._moonViewer.dataSources._dataSources[0]._entityCollection.getById(idRef).position._property._interpolationResult
      )
      if (originpoint.x !== undefined) {
        const center = CZML_GENERALTOOLS_CLASS.J2000toFIXED(this._moonViewer.clock.currentTime, originpoint)
        const FacilityPos = Cesium.Cartesian3.add(center, Offset, new Cesium.Cartesian3())
        // FacilityPos = [center.x+Offset[0],center.y+Offset[1],center.z+Offset[2]];//分别为弧线端点a、弧线端点b和顶点位置
        return FacilityPos
      }
    }
    // 添加地面站
    this._moonViewer.entities.add({
      id: id,
      name: name,
      position: new Cesium.CallbackProperty(getPosition(), false),
      orientation: new Cesium.Quaternion(0, 0, 0, 1),
      model: {
        uri: Model3DPath,
        show: ModelVisible,
        scale: ModelSize,
        distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, Distance),
        runAnimations: false
      },
      label: {
        text: name,
        fillColor: Cesium.Color.fromBytes(255, 0, 0, 255),
        font: "11pt Lucida Console",
        horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
        pixelOffset: new Cesium.Cartesian2(10, 0)
      },
      billboard: {
        image: MarkerPath,
        show: MarkerVisible,
        horizontalOrigin: Cesium.HorizontalOrigin.CENTER, // X
        verticalOrigin: Cesium.VerticalOrigin.CENTER, // Y
        distanceDisplayCondition: new Cesium.DistanceDisplayCondition(Distance),
        scale: MaekerPixelSize
      }
    })
  }

  /**
   *
   * 添加通信链路
   * @param {*} idTarget 通信接口目标ID，UUID字符串，比如火箭的ID
   * @param {*} idBasic 地面站的ID，UUID字符串
   * @param {*} idBasicPosition 地面站的位置，[经度,纬度,高度]([30,30,0])
   * @param {*} vOrbitStartTime 起始时间UTCG数组，字符串
   * @param {*} vOrbitEndTime 结束时间UTCG数组，字符串
   * @param {*} width 线宽
   * @param {*} LineColor 线的颜色
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddCommunicationLinkofMoon(idTarget, idBasic, idBasicPosition, vOrbitStartTime, vOrbitEndTime, width, LineColor) {
    const sDataStartTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(vOrbitStartTime)
    const sDataEndTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(vOrbitEndTime)
    const id = idTarget + "-to-" + idBasic
    const LinePosition = []
    const Offset = Cesium.Cartesian3.fromArray(CZML_GENERALTOOLS_CLASS.GetMaterialObject(idBasicPosition))
    // 线位置更新
    const getLinePosition = function () {
      const DiqiuPosition = Cesium.Cartesian3.fromArray(
        this._moonViewer.dataSources._dataSources[0]._entityCollection.getById("diqiu").position._property._interpolationResult
      )
      const Point2 = Cesium.Cartesian3.fromArray(
        this._moonViewer.dataSources._dataSources[0]._entityCollection.getById(idTarget).position._property._interpolationResult
      )
      if (DiqiuPosition.x !== undefined && Point2.x !== undefined) {
        const center = CZML_GENERALTOOLS_CLASS.J2000toFIXED(this._moonViewer.clock.currentTime, DiqiuPosition)
        const Point1 = Cesium.Cartesian3.add(center, Offset, new Cesium.Cartesian3())
        LinePosition[0] = Point1
        LinePosition[1] = Point2
        return LinePosition
      }
    }
    // 添加通信链路
    this._moonViewer.entities.add({
      id: id,
      availability: new Cesium.TimeIntervalCollection([
        new Cesium.TimeInterval({
          start: Cesium.JulianDate.fromIso8601(sDataStartTime),
          stop: Cesium.JulianDate.fromIso8601(sDataEndTime)
        })
      ]),
      polyline: {
        positions: new Cesium.CallbackProperty(getLinePosition(), false),
        width: width,
        followSurface: false,
        material: Cesium.Color.fromBytes(LineColor[0], LineColor[1], LineColor[2], LineColor[3])
      }
    })
  }

  /**
   *
   * 添加场景中的动态线
   * @param {*} id 该动态线唯一id，服务化平台给出的UUID，字符串
   * @param {*} name 动态线的名称，字符串
   * @param {*} DataStartTime 动态线开始时刻，字符串，输入格式为UTCG
   * @param {*} DataEndTime 动态线终止时刻，字符串，输入格式为UTCG
   * @param {*} StartPos 起始点数据，参考ID或数组，参考ID为地面站则输入位置数组
   * @param {*} StartPosType 起始点数据类型，0为参考id是地面站，1为参考id是其他对象，2位数组
   * @param {*} EndPos 终点数据，参考ID或数组，参考ID为地面站则输入位置数组
   * @param {*} EndPosType 终点数据类型，0为参考id是地面站，1为参考id是其他对象，2位数组
   * @param {*} LineWidth 线的宽度
   * @param {*} LineColor 线的颜色，数组：[R,G,B,255]（[255,0,0,255]）
   * @param {*} LineStyle 线的类型：（0实线/1虚线/2箭头）
   * @param {*} MarkerVisible name文本是否可见（true/false)
   * @param {*} ReferenceFrame 轨迹姿态的参考系设定，字符串，两种可选（"FIXED" ，"INERTIAL"）默认为"FIXED"
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddLineofMoonByEntity(
    id,
    name,
    DataStartTime,
    DataEndTime,
    StartPos,
    StartPosType,
    EndPos,
    EndPosType,
    LineWidth,
    LineColor,
    LineStyle,
    MarkerVisible,
    ReferenceFrame
  ) {
    const posAid = id + "-to-posA"
    const posBid = id + "-to-posB"

    // UTCG时间格式转换
    const sDataStartTimeStartPos = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(DataStartTime)
    const sDataStartTimeEndPos = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(DataEndTime)
    const AvailabilityTime = sDataStartTimeStartPos + "/" + sDataStartTimeEndPos

    if (StartPosType !== 0) {
      const posA = {
        id: posAid,
        name: name,
        availability: AvailabilityTime,
        show: true,
        label: {
          fillColor: {
            rgba: LineColor
          },
          font: "11pt Lucida Console",
          horizontalOrigin: "CENTER",
          pixelOffset: {
            cartesian2: [30, 10]
          },
          show: false,
          style: "FILL_AND_OUTLINE",
          text: name,
          verticalOrigin: "CENTER"
        },
        position: {
          interpolationAlgorithm: "LAGRANGE",
          interpolationDegree: 5,
          referenceFrame: ReferenceFrame,
          epoch: sDataStartTimeStartPos,
          cartesian: StartPos
        }
      }
      if (StartPosType === 1) {
        const FindObjectNode = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.find(function (node) {
          return node.data().id === StartPos
        })

        const DatPosRef = FindObjectNode.data().position
        posA.position = DatPosRef
      }

      this.HEU_CzmlListInsertmoon(posAid, posA, true)
    }

    if (EndPosType !== 0) {
      const posB = {
        id: posBid,
        name: name,
        availability: AvailabilityTime,
        show: true,
        label: {
          fillColor: {
            rgba: LineColor
          },
          font: "11pt Lucida Console",
          horizontalOrigin: "CENTER",
          pixelOffset: {
            cartesian2: [30, 10]
          },
          show: MarkerVisible,
          style: "FILL_AND_OUTLINE",
          text: name,
          verticalOrigin: "CENTER"
        },
        position: {
          interpolationAlgorithm: "LAGRANGE",
          interpolationDegree: 5,
          referenceFrame: ReferenceFrame,
          epoch: sDataStartTimeStartPos,
          cartesian: EndPos
        }
      }
      if (EndPosType === 1) {
        const FindObjectNode = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.find(function (node) {
          return node.data().id === EndPos
        })

        const DatPosRef = FindObjectNode.data().position
        posB.position = DatPosRef
      }
      // 插入该数据对象
      this.HEU_CzmlListInsertmoon(posBid, posB, true)
    }

    if (EndPosType !== 0 && StartPosType !== 0) {
      const PosARef = posAid + "#position"
      const PosBRef = posBid + "#position"

      const Line = {
        id: id,
        name: name,
        availability: AvailabilityTime,
        polyline: {
          show: [
            {
              interval: AvailabilityTime,
              boolean: true
            }
          ],
          width: LineWidth,
          material: {
            solidColor: {
              color: {
                rgba: LineColor
              }
            }
          },
          followSurface: false,
          positions: {
            references: [PosARef, PosBRef]
          }
        }
      }
      if (LineStyle === 1) {
        Line.polyline.material = {
          polylineDash: {
            color: {
              rgba: LineColor
            }
          }
        }
      }
      // 箭头
      if (LineStyle === 2) {
        Line.polyline.material = {
          polylineArrow: {
            color: {
              rgba: LineColor
            }
          }
        }
      }
      this.HEU_CzmlListInsertmoon(id, Line, true)
    }
    // 上图
    this.HEU_CesiumLoadCzmlmoon(this._moonViewer)

    if (StartPosType === 0) {
      const Offset = Cesium.Cartesian3.fromArray(CZML_GENERALTOOLS_CLASS.GetMaterialObject(StartPos))
      const ccunfangweizhi = []
      const update = function (scene, time) {
        const originpoint = Cesium.Cartesian3.fromArray(
          this._moonViewer.dataSources._dataSources[0]._entityCollection.getById("diqiu").position._property._interpolationResult
        )
        const point2 = Cesium.Cartesian3.fromArray(
          this._moonViewer.dataSources._dataSources[0]._entityCollection.getById(posBid).position._property._interpolationResult
        )
        if (originpoint.x !== undefined && point2.x !== undefined) {
          const center = CZML_GENERALTOOLS_CLASS.J2000toFIXED(this._moonViewer.clock.currentTime, originpoint)
          const FacilityPos = Cesium.Cartesian3.add(center, Offset, new Cesium.Cartesian3())
          ccunfangweizhi[0] = FacilityPos
          ccunfangweizhi[1] = point2
          return ccunfangweizhi
        }
      }

      const Line2 = this._moonViewer.entities.add({
        id: id,
        name: name,
        availability: new Cesium.TimeIntervalCollection([
          new Cesium.TimeInterval({
            start: Cesium.JulianDate.fromIso8601(sDataStartTimeStartPos),
            stop: Cesium.JulianDate.fromIso8601(sDataStartTimeEndPos)
          })
        ]),
        polyline: {
          positions: new Cesium.CallbackProperty(update, false),
          width: LineWidth,
          followSurface: false,
          material: Cesium.Color.fromBytes(LineColor[0], LineColor[1], LineColor[2], LineColor[3])
        }
      })
      if (LineStyle === 1) {
        Line2.polyline.material = new Cesium.PolylineDashMaterialProperty({
          color: Cesium.Color.fromBytes(LineColor[0], LineColor[1], LineColor[2], LineColor[3])
        })
      }
      if (LineStyle === 2) {
        Line2.polyline.material = new Cesium.PolylineArrowMaterialProperty(
          Cesium.Color.fromBytes(LineColor[0], LineColor[1], LineColor[2], LineColor[3])
        )
      }
    }

    if (EndPosType === 0) {
      const Offset = Cesium.Cartesian3.fromArray(CZML_GENERALTOOLS_CLASS.GetMaterialObject(EndPos))
      const ccunfangweizhi = []
      const update = function (scene, time) {
        const originpoint = Cesium.Cartesian3.fromArray(
          this._moonViewer.dataSources._dataSources[0]._entityCollection.getById("diqiu").position._property._interpolationResult
        )
        const point2 = Cesium.Cartesian3.fromArray(
          this._moonViewer.dataSources._dataSources[0]._entityCollection.getById(posBid).position._property._interpolationResult
        )
        if (originpoint.x !== undefined && point2.x !== undefined) {
          const center = CZML_GENERALTOOLS_CLASS.J2000toFIXED(this._moonViewer.clock.currentTime, originpoint)
          const FacilityPos = Cesium.Cartesian3.add(center, Offset, new Cesium.Cartesian3())
          ccunfangweizhi[0] = point2
          ccunfangweizhi[1] = FacilityPos
          return ccunfangweizhi
        }
      }

      const Line2 = this._moonViewer.entities.add({
        id: id,
        name: name,
        availability: new Cesium.TimeIntervalCollection([
          new Cesium.TimeInterval({
            start: Cesium.JulianDate.fromIso8601(sDataStartTimeStartPos),
            stop: Cesium.JulianDate.fromIso8601(sDataStartTimeEndPos)
          })
        ]),
        polyline: {
          positions: new Cesium.CallbackProperty(update, false),
          width: LineWidth,
          followSurface: false,
          material: Cesium.Color.fromBytes(LineColor[0], LineColor[1], LineColor[2], LineColor[3])
        }
      })
      if (LineStyle === 1) {
        Line2.polyline.material = new Cesium.PolylineDashMaterialProperty({
          color: Cesium.Color.fromBytes(LineColor[0], LineColor[1], LineColor[2], LineColor[3])
        })
      }
      if (LineStyle === 2) {
        Line2.polyline.material = new Cesium.PolylineArrowMaterialProperty(
          Cesium.Color.fromBytes(LineColor[0], LineColor[1], LineColor[2], LineColor[3])
        )
      }
    }
  }

  /**
   *
   * 月心J2000到月固系坐标转换
   * @param {*} JDTime 转换时间，Julian格式字符串
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  static computeMoonJ2000ToMoonFixedMatrix(JDTime) {
    const DTR = Cesium.Math.PI / 180

    JDTime = JDTime.secondsOfDay / 86400 + JDTime.dayNumber
    const T = (JDTime - 2451545) / 36525
    const d = JDTime - 2451545

    const sin = Math.cos
    const cos = Math.cos
    const pow = Math.pow

    // 单位 rad
    const E1 = (125.045 - 0.0529921 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E2 = (250.089 - 0.1059842 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E3 = (260.008 + 13.0120009 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E4 = (176.625 + 13.3407154 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E5 = (357.529 + 0.9856003 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E6 = (311.589 + 26.4057084 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E7 = (134.963 + 13.064993 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E8 = (276.617 + 0.3287146 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E9 = (34.226 + 1.7484877 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E10 = (15.134 - 0.1589763 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E11 = (119.743 + 0.0036096 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E12 = (239.961 + 0.1643573 * d) * Cesium.Math.RADIANS_PER_DEGREE
    const E13 = (25.053 + 12.9590088 * d) * Cesium.Math.RADIANS_PER_DEGREE

    // 单位 rad
    const alpha =
      269.9949 +
      0.0031 * T -
      3.8787 * sin(E1) -
      0.1204 * sin(E2) +
      0.07 * sin(E3) -
      0.0172 * sin(E4) +
      0.0072 * sin(E6) -
      0.0052 * sin(E10) +
      0.0043 * sin(E13)

    const delta =
      66.5392 +
      0.013 * T +
      1.5419 * cos(E1) +
      0.0239 * cos(E2) -
      0.0278 * cos(E3) +
      0.0068 * cos(E4) -
      0.0029 * cos(E6) +
      0.0009 * cos(E7) +
      0.0008 * cos(E10) -
      0.0009 * cos(E13)

    let W =
      38.3198230683545 +
      13.1763597812418 * d -
      1.4e-12 * pow(d, 2) +
      3.561 * sin(E1) +
      0.1208 * sin(E2) -
      0.0642 * sin(E3) +
      0.0158 * sin(E4) +
      0.0252 * sin(E5) -
      0.0066 * sin(E6) -
      0.0047 * sin(E7) -
      0.0046 * sin(E8) +
      0.0028 * sin(E9) +
      0.0052 * sin(E10) +
      0.004 * sin(E11) +
      0.0019 * sin(E12) -
      0.0044 * sin(E13)

    W = Cesium.Math.mod(W, 360)

    let th = W * DTR
    const cz = new Cesium.Matrix3(cos(th), sin(th), 0, -sin(th), cos(th), 0, 0, 0, 1)
    th = (90 - delta) * DTR
    const cx = new Cesium.Matrix3(1, 0, 0, 0, cos(th), sin(th), 0, -sin(th), cos(th))
    th = (90 + alpha) * DTR
    const cz2 = new Cesium.Matrix3(cos(th), sin(th), 0, -sin(th), cos(th), 0, 0, 0, 1)
    const output1 = Cesium.Matrix3.multiply(cz, cx, new Cesium.Matrix3())
    const output = Cesium.Matrix3.multiply(output1, cz2, new Cesium.Matrix3())
    return output
  }

  /**
   *
   * 计算地球位置（内部接口）
   * @param {*} Moonj2000data 月球地心j2000位置坐标，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]([0,30,30,30,5,30,30,30])，相对秒与地心j2000相对秒数一致
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  static earthposition(Moonj2000data) {
    const data = []
    for (let i = 0; i < Moonj2000data.length / 4; i++) {
      const moonCartesian = new Cesium.Cartesian3(Moonj2000data[4 * i + 1], Moonj2000data[4 * i + 2], Moonj2000data[4 * i + 3])
      const position = Cesium.Cartesian3.negate(moonCartesian, new Cesium.Cartesian3())
      data[4 * i] = Moonj2000data[4 * i]
      data[4 * i + 1] = position.x
      data[4 * i + 2] = position.y
      data[4 * i + 3] = position.z
    }
    return data
  }

  /**
   *
   * 地心j2000位置坐标到月固系坐标转换
   * @param {*} Earthj2000data 地心j2000位置坐标，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]([0,30,30,30,5,30,30,30])
   * @param {*} Moonj2000data 月球地心j2000位置坐标，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]([0,30,30,30,5,30,30,30])，相对秒与地心j2000相对秒数一致
   * @param {*} DataStartTime 第一组数据的时间，UTCG格式字符串
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  static Earthj2000PositiontoMoonj2000(Earthj2000data, Moonj2000data, DataStartTime) {
    const data = []
    for (let i = 0; i < Earthj2000data.length / 4; i++) {
      const DataStartTimeJD = Cesium.JulianDate.fromIso8601(CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(DataStartTime))
      const timeInterval = Moonj2000data[4 * i + 4] - Moonj2000data[4 * i]
      const TransformTime = Cesium.JulianDate.addSeconds(DataStartTimeJD, timeInterval, new Cesium.JulianDate())
      const TransformMatrix = CZML_MOONVIEWER_CLASS.computeMoonJ2000ToMoonFixedMatrix(TransformTime)

      data[4 * i] = Earthj2000data[4 * i]
      const moonCartesian = new Cesium.Cartesian3(Moonj2000data[4 * i + 1], Moonj2000data[4 * i + 2], Moonj2000data[4 * i + 3])
      const Earthj2000Cartesian = new Cesium.Cartesian3(Earthj2000data[4 * i + 1], Earthj2000data[4 * i + 2], Earthj2000data[4 * i + 3])
      const dataTransform = Cesium.Cartesian3.add(
        Cesium.Cartesian3.negate(moonCartesian, new Cesium.Cartesian3()),
        Earthj2000Cartesian,
        new Cesium.Cartesian3()
      )
      const pointInmoonFixed = Cesium.Matrix3.multiplyByVector(TransformMatrix, dataTransform, new Cesium.Cartesian3())
      data[4 * i + 1] = pointInmoonFixed.x
      data[4 * i + 2] = pointInmoonFixed.y
      data[4 * i + 3] = pointInmoonFixed.z
    }
    return data
  }

  /**
   *
   * 大地经纬度坐标转月心j2000
   * @param {*} Moonj2000data 月球j2000位置坐标，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]([0,30,30,30,5,30,30,30])
   * @param {*} LLAPosition 大地经纬度数组,单位为度和米[经度，纬度，高度]
   * @param {*} DataStartTime 月球j2000位置坐标中，第一组数据对应的时间。UTCG格式字符串
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  static GeodetictoMoonj2000(Moonj2000data, LLAPosition, DataStartTime) {
    const data = []
    const LLAPositiontofixedArray = CZML_GENERALTOOLS_CLASS.GeodeticToCartesian(LLAPosition)
    const LLAPositiontofixed = new Cesium.Cartesian3(LLAPositiontofixedArray[0], LLAPositiontofixedArray[1], LLAPositiontofixedArray[2])
    for (let i = 0; i < Moonj2000data.length / 4; i++) {
      const DataStartTimeJD = Cesium.JulianDate.fromIso8601(CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(DataStartTime))
      const timeInterval = Moonj2000data[i * 4]
      const TransformTime = Cesium.JulianDate.addSeconds(DataStartTimeJD, timeInterval, new Cesium.JulianDate())
      // let TransformMatrix = computeMoonJ2000ToMoonFixedMatrix(TransformTime);
      const FacilityPositiontoj2000 = CZML_GENERALTOOLS_CLASS.FIXEDtoJ2000(TransformTime, LLAPositiontofixed)
      data[4 * i] = Moonj2000data[4 * i]
      const moonCartesian = new Cesium.Cartesian3(Moonj2000data[4 * i + 1], Moonj2000data[4 * i + 2], Moonj2000data[4 * i + 3])
      const dataTransform = Cesium.Cartesian3.add(
        Cesium.Cartesian3.negate(moonCartesian, new Cesium.Cartesian3()),
        FacilityPositiontoj2000,
        new Cesium.Cartesian3()
      )
      data[4 * i + 1] = dataTransform.x
      data[4 * i + 2] = dataTransform.y
      data[4 * i + 3] = dataTransform.z
    }
    return data
  }

  /**
   *
   * 地心j2000位置坐标到月心j2000坐标转换
   * @param {*} Moonj2000data 月球地心j2000位置坐标，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]([0,30,30,30,5,30,30,30])
   * @param {*} Earthj2000data 需要转换的地心j2000位置坐标，数组：[相对秒1,X1,Y1,Z1,相对秒2,X2,Y2,Z2]([0,30,30,30,5,30,30,30])
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  static sunofEVtoMoonj2000(Moonj2000data, Earthj2000data) {
    const data = []
    for (let i = 0; i < Earthj2000data.length / 4; i++) {
      data[4 * i] = Earthj2000data[4 * i]
      const moonCartesian = new Cesium.Cartesian3(Moonj2000data[4 * i + 1], Moonj2000data[4 * i + 2], Moonj2000data[4 * i + 3])
      const earthCartesian = new Cesium.Cartesian3(Earthj2000data[4 * i + 1], Earthj2000data[4 * i + 2], Earthj2000data[4 * i + 3])
      const dataTransform = Cesium.Cartesian3.add(
        Cesium.Cartesian3.negate(moonCartesian, new Cesium.Cartesian3()),
        earthCartesian,
        new Cesium.Cartesian3()
      )
      data[4 * i + 1] = dataTransform.x
      data[4 * i + 2] = dataTransform.y
      data[4 * i + 3] = dataTransform.z
    }
    return data
  }

  /**
   *
   * 根据指定ID删除月球场景中地面站以外的对象
   * @param {*} id <String> cesium场景中渲染对象ID，UUID字符串
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_DeleteMoonObjectByID(id) {
    for (let j = 0; j < this._moonViewer.entities._entities._array.length; ++j) {
      const flag = this._moonViewer.entities._entities._array[j].id.includes(id)

      if (flag) {
        this._moonViewer.entities.remove(this._moonViewer.entities._entities._array[j])
        j -= 1
      }
    }

    const MapNodes = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.map(function (node) {
      return node.data().id.includes(id)
    })
    for (let i = 0; i < MapNodes.length; i++) {
      CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.remove(MapNodes[i])
    }
    if (MapNodes.length > 0) {
      this.HEU_CesiumLoadCzmlmoon(this._moonViewer)
    }
  }

  /**
   *
   * 根据指定ID删除月球场景中的地面站
   * @param {*} id <String> cesium场景中渲染对象ID，UUID字符串
   * @param {*} viewer 对应中心天体
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_DeleteByMVFacility(id, viewer) {
    // 移除地面站
    this._moonViewer.entities.remove(this._moonViewer.entities.getById(id))

    // 查询该id相关的所有元素
    const MapNodes = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.map(function (node) {
      return node.data().id.includes(id)
    })
    // 循环删除所有满足条件的节点
    for (let i = 0; i < MapNodes.length; i++) {
      if (MapNodes[i]._data.id.includes("-to-show")) {
        const rockId = MapNodes[i]._data.id.split("-to-show")[0] // huojian
        // 对idOther进行循环
        const FindNode = CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.find(function (node) {
          return node.data().id === rockId
        })
        const CurPathwidth = FindNode.data().path.width
        const CurPosition = FindNode.data().position
        // 添加对象
        const ShowOrbitData = {
          id: rockId + "back",
          availability: FindNode.data().availability,
          path: {
            show: true,
            width: CurPathwidth, // 轨道宽度
            material: FindNode.data().path.material,
            resolution: 120
          },
          position: CurPosition
        }
        CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.push(ShowOrbitData)
      }
      CZML_MOONVIEWER_CLASS.HEU_CzmlListmoon.remove(MapNodes[i])
    }
    if (MapNodes.length > 0) {
      // 上图
      this.HEU_CesiumLoadCzmlmoon(viewer)
    }
  }

  /**
   *
   * 添加月球
   * @param {*} OrbitStartTime
   * @param {*} OrbitEndTime
   * @param {*} scale
   * @param {*} Model3DPath
   * @param {*} viewer
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddmooninMV(OrbitStartTime, OrbitEndTime, scale, Model3DPath, viewer) {
    // viewer.scene.globe.show=false;
    const sOrbitStartTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitStartTime)
    const sOrbitEndTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitEndTime)
    const AvailabilityTime = sOrbitStartTime + "/" + sOrbitEndTime
    const MoonData = {
      id: "Moon",
      availability: AvailabilityTime,
      name: "月球",
      description: "MoonbyCZML",
      label: {
        fillColor: {
          rgba: [0, 255, 0, 255]
        },
        font: "11pt Lucida Console",
        horizontalOrigin: "LEFT",
        pixelOffset: {
          cartesian2: [10, 0]
        },
        show: false,
        style: "FILL_AND_OUTLINE",
        text: "StarbyCZML",
        verticalOrigin: "CENTER"
      },
      // 更改模型路径
      model: {
        gltf: Model3DPath,
        scale: scale,
        minimumPixelSize: 1
      },
      position: {
        interpolationAlgorithm: "LAGRANGE",
        interpolationDegree: 5,
        referenceFrame: "FIXED",
        epoch: sOrbitStartTime,
        cartesian: [0, 0, 0]
      },
      orientation: {
        interpolationAlgorithm: "LAGRANGE",
        interpolationDegree: 1,
        epoch: sOrbitStartTime,
        unitQuaternion: [0, 0, 0, 1]
      }
    }
    // 插入该数据对象
    const ret = this.HEU_CzmlListInsertmoon("Moon", MoonData, true)
    // 上图
    this.HEU_CesiumLoadCzmlmoon(viewer)
    return ret
  }

  /**
   *
   *
   * @param {*} id
   * @param {*} position
   * @param {*} OrbitStartTime
   * @param {*} OrbitEndTime
   * @param {*} ReferenceFrame
   * @param {*} viewer
   * @returns
   * @memberof CZML_MOONVIEWER_CLASS
   */
  HEU_AddPointMoon(id, position, OrbitStartTime, OrbitEndTime, ReferenceFrame, viewer) {
    const sOrbitStartTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitStartTime)
    const sOrbitEndTime = CZML_GENERALTOOLS_CLASS.Utcg2ISO8601TimeTransformation(OrbitEndTime)
    const AvailabilityTime = sOrbitStartTime + "/" + sOrbitEndTime
    const pointId = id + "-point"

    const point = {
      id: pointId,
      availability: AvailabilityTime,
      position: {
        interpolationAlgorithm: "LAGRANGE",
        interpolationDegree: 5,
        referenceFrame: ReferenceFrame,
        epoch: sOrbitStartTime,
        cartesian: position
      }
    }
    // 插入该数据对象
    const ret = this.HEU_CzmlListInsertmoon(pointId, point, true)
    // 上图
    this.HEU_CesiumLoadCzmlmoon(viewer)
    return ret
  }
}

export default CZML_MOONVIEWER_CLASS
